import 'package:bike_ride/common/util/hysize_fit.dart';
import 'package:bike_ride/res/style/color_styles.dart';
import 'package:flutter/material.dart';

class SuperButtonWidget extends StatefulWidget {
  final String btnText;
  final String? iconPath;
  final Function()? onPressed;
  final bool? isLoading;
  final bool? isDisabled;
  final Color? bgColor;
  final Color? textColor;
  final double? fontSize;
  final double? height;

  const SuperButtonWidget(
      {super.key,
      required this.btnText,
      this.iconPath,
      this.onPressed,
      this.isLoading,
      this.isDisabled, this.bgColor, this.textColor, this.fontSize, this.height});

  @override
  State<SuperButtonWidget> createState() => _SuperButtonWidgetState();
}

class _SuperButtonWidgetState extends State<SuperButtonWidget> {
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: widget.onPressed,
      child: Container(
        height: widget.height??96.rpx,
        padding: EdgeInsets.symmetric(vertical: 16.rpx),
        decoration: BoxDecoration(
          borderRadius: const BorderRadius.all(Radius.circular(8)),
          color: widget.bgColor??Theme.of(context).colorScheme.primary,
        ),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            if (widget.iconPath != null)
              ...[
                Image.asset(
                  widget.iconPath!,
                  width: 18,
                  height: 18,
                ),
                const SizedBox(
                  width: 4,
                ),
              ],
            Text(
              widget.btnText,
              textAlign: TextAlign.center,
              style: TextStyle(
                  fontSize: widget.fontSize??32.rpx,
                  color: widget.textColor??ColorStyles.color_FFFFFF,
                  fontWeight: FontWeight.w500),
            ),
          ],
        ),
      ),
    );
  }
}
